Skip to content

feat: per-call arcsec_after_decimal override for arcsecond tick labels - #547

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/arcsec-after-decimal
Sep 10, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/arcsec-after-decimal

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Closes #546.

Summary

The arcsecond symbol-over-decimal formatting already shipped: _arcsec_labels renders 3.″8 when ticks.symbol_over_decimal is set in visualize/general.yaml. But the switch was global config only, so a script wanting it for one figure had to mutate conf.instance and restore it afterwards — the fragile, stateful pattern the originating request was filed to remove.

This threads a per-call override down the plotting stack, so plot_array(..., arcsec_after_decimal=True) works on a single call without touching config.

The public name (arcsec_after_decimal, the one users read) differs from the internal/config name (symbol_over_decimal, already shipped and documented in general.yaml). Renaming the config key would break anyone who has already set it, so the two are bridged at each public function's apply_extent call rather than unified.

API Changes

Three public plotting functions gain one optional keyword, arcsec_after_decimal: Optional[bool] = None — plot_array, plot_grid and plot_inversion_reconstruction. True forces the symbol-over-decimal form, False forces the suffix form, and None (the default) reads the config flag exactly as before.

Purely additive. No signature is reordered, no default changes, and None is byte-for-byte the old behaviour — the config read simply moved into an if symbol_over_decimal is None: fallback. The config key symbol_over_decimal is unchanged and general.yaml is untouched.

See full details below.

Test Plan

  • test_autoarray/plot → 35 passed (test_utils.py: 33 = 30 baseline + 3 new)
  • The four pre-existing config-driven arcsec tests pass unmodified
  • Three new tests cover the override in both directions: argument-only with config off and conf.instance never mutated; explicit False beating a config True; None still following config in both states
  • End-to-end through the wrapper — plot_array at all three flag values on a 10×10 Array2D, reading the labels back off the axes:
    • arcsec_after_decimal=True → ['-1.″9', '0.″0', '1.″9']
    • arcsec_after_decimal=None → ['-1.9"', '0.0"', '1.9"']
    • arcsec_after_decimal=False → ['-1.9"', '0.0"', '1.9"']
  • Wider suite test_autoarray → 1408 passed, 74 skipped, 8 failed — all pre-existing and unrelated, confirmed by re-running them in a detached worktree at the pristine branch point 35aa681f, where they fail identically. Cause is ModuleNotFoundError: No module named 'numba' in this container; all 8 are w-tilde / sparse-operator tests under test_autoarray/inversion/, which this diff does not touch.

Heart gate: pyauto-heart is not reachable from this remote session, so the documented fallback (per-repo pytest as the gate) was used — see the counts above.

Full API Changes (for automation & release notes)

Added

  • autoarray.plot.plot_array(..., arcsec_after_decimal: Optional[bool] = None) — per-call override of the ticks.symbol_over_decimal config flag
  • autoarray.plot.plot_grid(..., arcsec_after_decimal: Optional[bool] = None) — same
  • autoarray.plot.plot_inversion_reconstruction(..., arcsec_after_decimal: Optional[bool] = None) — same
  • autoarray.plot.utils.apply_extent(ax, extent, symbol_over_decimal: Optional[bool] = None) — forwards the override to the label formatter
  • autoarray.plot.utils._arcsec_labels(ticks, symbol_over_decimal: Optional[bool] = None) — None reads config, True/False override it

Removed

  • Nothing.

Migration

  • None required — every existing call site keeps its current behaviour.
  • Before (per-figure override): conf.instance["visualize"]["general"]["ticks"]["symbol_over_decimal"] = True … then restore it
  • After: plot_array(array=array, arcsec_after_decimal=True)

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_019mofs7R3chP12wzoCPjnaw


Generated by Claude Code

#546)

The arcsecond symbol-over-decimal format (3.″8 rather than 3.8") was
switchable only through the global `ticks.symbol_over_decimal` config
flag, so a single figure could not opt in without mutating
`conf.instance`.

`_arcsec_labels` and `apply_extent` now take a `symbol_over_decimal`
argument that overrides the config in both directions; `None` (the
default) still reads the config, so every existing caller is unchanged.
The public plotting functions `plot_array`, `plot_grid` and
`plot_inversion_reconstruction` expose it as `arcsec_after_decimal`,
bridging the public API name to the internal/config name at that
boundary (the shipped config key is untouched).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019mofs7R3chP12wzoCPjnaw
@Jammy2211
Jammy2211 merged commit 7955a7e into main Sep 10, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/arcsec-after-decimal branch September 10, 2026 00:08
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Sep 10, 2026 — with Claude
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: per-call arcsec_after_decimal option for arcsecond tick labels

1 participant